package com.zy.explore.sys.interfaces.facade.v1;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zy.explore.common.interfaces.vo.ResultVO;
import com.zy.explore.sys.interfaces.assembler.StationMsgAssembler;
import com.zy.explore.sys.interfaces.frm.StaMsgSaveFrm;
import com.zy.explore.sys.interfaces.vo.SendToUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * description 站内信门面
 *
 * @author 🇨🇳中国印🇨🇳
 * @date 2021年07月11日 23:20
 */
@Slf4j
@Api(tags = "StationMsg控制器")
@RestController
@RequestMapping("/staMsg")
public class StationMsgFacade {

    @Resource
    private StationMsgAssembler assembler;

    @ApiOperationSupport(order = 10)
    @ApiOperation("保存站内信")
    @PostMapping("/save")
    public ResultVO<Boolean> save(@RequestBody @Valid StaMsgSaveFrm frm) {
        return ResultVO.getSuccess(assembler.save(frm));
    }

    @ApiOperationSupport(order = 20)
    @ApiOperation("查询发送对象集合")
    @GetMapping("/getSendUserList")
    public ResultVO<List<SendToUserVO>> getSendUserList() {
        return ResultVO.getSuccess(assembler.getSendUserList());
    }


}
